<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/web/common.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统HTML模板--模板之家 www.cssmoban.com</title>
<link href="${ctx}/assets/css/style.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="${ctx}/assets/js/jquery.js"></script>

<script type="text/javascript">
	$(document).ready(function() {
		$(".click").click(function() {
			$(".tip").fadeIn(200);
		});

		$(".tiptop a").click(function() {
			$(".tip").fadeOut(200);
		});

		$(".sure").click(function() {
			$(".tip").fadeOut(100);
		});

		$(".cancel").click(function() {
			$(".tip").fadeOut(100);
		});

	});
</script>


</head>


<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">首页</a></li>
			<li><a href="#">订单</a></li>
		</ul>
	</div>

	<div class="rightinfo">

		<div class="tools">

			<ul class="toolbar">
				<li class="click"><span><img
						src="${ctx}/assets/images/t01.png" /></span> <a
					href="${ctx}/admin/order/add">添加</a></li>
				<li class="click"><span><img
						src="${ctx}/assets/images/t02.png" /></span>修改</li>
				<li><span><img src="${ctx}/assets/images/t03.png" /></span>删除</li>
				<li><span><img src="${ctx}/assets/images/t04.png" /></span>统计</li>
			</ul>


			<ul class="toolbar1">
				<li><span><img src="${ctx}/assets/images/t05.png" /></span>设置</li>
			</ul>

		</div>


		<table class="tablelist">
			<thead>
				<tr>

					<th>编号<i class="sort"><img
							src="${ctx}/assets/images/px.gif" /></i></th>
					<th>订单号</th>
					<th>车主</th>
					<th>车主手机</th>
					<th>创建时间</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${page.list}" var="obj" varStatus="vs">
					<tr>
						<td>${vs.index + 1 + (page.pageSize * (page.pageNum - 1))}</td>
						<td>${obj.taobaoorderid}</td>
						<td>${obj.linkname}</td>
						<td>${obj.linkmobile}</td>
						<td><fmt:formatDate value="${obj.createtime}"
								pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
						<td><c:choose>
								<c:when test="${obj.state eq 0}">新订单</c:when>
								<c:when test="${obj.state eq 1}">未安装</c:when>
								<c:when test="${obj.state eq 2}">待核销</c:when>
								<c:when test="${obj.state eq 3}">待回访</c:when>
								<c:when test="${obj.state eq 31}">售后中</c:when>
								<c:when test="${obj.state eq 100}">已结束</c:when>

							</c:choose></td>
						<td><a href="${ctx}/admin/order/view/${obj.id}"
							class="tablelink">查看</a>
							 <a href="${ctx}/admin/paidan/dispatcher/${obj.id}"
							class="tablelink1" style="display: block">派单</a>
							 <a href="javascript:deleteConfirm('${obj.id}')" class="tablelink2"
							style="display: none">重新派单</a></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>

		<div class="pagin">
			<div class="message">
				共<i class="blue"> ${ page.total }</i>条记录，当前显示第&nbsp;<i class="blue">${ page.pageNum }&nbsp;</i>页
			</div>
			<ul class="paginList">
				<li class="paginItem"><a href="javascript:;">首页</a></li>
				<li class="paginItem"><a href="javascript:;"><span
						class="pagepre"></span></a></li>
				<li class="paginItem current"><a href="javascript:;">1</a></li>
				<li class="paginItem"><a href="javascript:;">2</a></li>
				<li class="paginItem"><a href="javascript:;">3</a></li>
				<li class="paginItem"><a href="javascript:;">4</a></li>
				<li class="paginItem more"><a href="javascript:;">...</a></li>
				<li class="paginItem"><a href="javascript:;"><span
						class="pagenxt"></span></a></li>
				<li class="paginItem"><a href="javascript:;">末页</a></li>
			</ul>
		</div>

	</div>

	<script type="text/javascript">
		var deleteConfirm = function(id) {
			if (confirm('确定重新派单吗？')) {
				//location.href='${ctx}/admin/order/delete?id='+id;
				location.href = "${ctx}" + "/admin/dispatch/send?id=" + id;
			}
		}

		$('.tablelist tbody tr:odd').addClass('odd');
	</script>
	<script type="text/javascript">
		$(function() {

			function DisplayAndHiddenBtn(btnclass, type) {
				var btnclass = $(".tablelink1");
				if (type == "d") {
					currentBtn.style.display = "block"; //style中的display属性
				} else if (type == "h") {
					currentBtn.style.display = "none";
				}
			}

			function goPage(page) {
				location.href = '${ctx}/admin/paidan/sendlist?currentpage='
						+ page;
			}

			$('.paginItem:first').click(function() {
				//实现首页
				goPage(1);
			});

			$('.pagenxt').click(function() {
				//实现下一页 
				var currentPage = '${page.pageNum}';
				var total = parseInt('${page.total}');
				var size = parseInt('${page.pageSize}');
				var maxPage = parseInt((total - 1) / size + 1);
				if (currentPage >= maxPage) {
					currentPage = maxPage;
				} else {
					currentPage = parseInt(currentPage) + 1;
				}
				goPage(currentPage);
			});

			$('.pagepre').click(function() {
				//实现上一页 
				var currentPage = '${page.pageNum}';

				if (currentPage > 1) {
					currentPage = parseInt(currentPage) - 1;
				} else {
					currentPage = 1;
				}
				goPage(currentPage);
			});

			$('.paginItem:last').click(function() {
				//实现末页 
				var total = parseInt('${page.total}');
				var size = parseInt('${page.pageSize}');
				var maxPage = parseInt((total - 1) / size + 1);
				goPage(maxPage);

			});

		});
	</script>
</body>
</html>
